#!/bin/bash

. $OPENARS_HOME/common/functions.h

cd `dirname $0`

if [ ! -s input/srvlist.lst ]; then
    echo "err: input/srvlist.lst is empty!"
    exit
fi
list=`cat input/srvlist.lst`

for server in $list
do
echo "-----------------"
echo $server
echo "-----------------"
$ORACLE_HOME/bin/sqlplus -s /NOLOG  <<END
    connect $CONNECT_ZABBIX
    SET ECHO OFF
    SET FEEDBACK OFF
    SET HEADING OFF
    set linesize 100
    set serveroutput on
    spool input/spool.cfg
    exec make_config('$server')
    exit;
END
sed s/\ *$// input/spool.cfg > input/configs2install/$server.cfg
done
rm -f input/spool.cfg
echo "-----------------"
